<template>
  <div class="my-header myBetween">
    <div class="logo">后台管理</div>
    <div class="header-right">
      <div class="header-user-con">
        <el-dropdown placement="bottom">
          <el-avatar class="user-avatar" :size="40"
                     :src="$store.state.currentAdmin.avatar">
          </el-avatar>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click.native="logout()">退出</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {}
  },

  computed: {},

  watch: {},

  created() {

  },

  mounted() {

  },

  methods: {
    logout() {
      this.$createHttp.logout().then((res) => {
        if (res.code === 200) {
          localStorage.removeItem("adminToken");
          this.$router.push({path: '/verify'});
        } else {
          this.$message({
            message: res.msg,
            type: "error",
          });
        }
      });
    }
  }
}
</script>

<style scoped>

.my-header {
  position: relative;
  width: 100%;
  height: 70px;
  color: black;
  background-color: #ebf1f6;
}

.my-header .logo {
  line-height: 70px;
  margin-left: 70PX;
  font-size: 22px;
}

.header-right {
  display: flex;
  justify-content: flex-end;
  margin-right: 40px;
}

.header-user-con {
  display: flex;
  align-items: center;
}

</style>
